In Sets, bags, and mixes§

See primary documentation in context for infix (+), infix ⊎.

Returns the Baggy addition of its arguments. More information.

In Operators§

See primary documentation in context for infix (+), infix ⊎.

multi infix:<(+)>(**@p)

Baggy addition operator.

Returns the Baggy addition of its arguments. This creates a new Bag from each element of the arguments with the weights of the element added together to get the new weight, if none of the arguments are a Mix or MixHash.

say <a a b c a d> (+) <a a b c c>; # OUTPUT: «Bag(a(5) b(2) c(3) d)␤»

If any of the arguments is a Mixy, the result is a new Mix.

say <a b c> (+) (a => 2.5, b => 3.14).Mix; # OUTPUT: «Mix(a(3.5) b(4.14) c)␤»